Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GS] Show all applications when opening the search bar #78741

Merged
merged 6 commits into from
Oct 5, 2020

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Sep 29, 2020

Summary

Fix #78174

  • change the defaultMaxProviderResults constant to allow all apps to be displayed
  • add circuit breaker on SO provider to avoid performing a search when the term is empty
  • add search subscription management to the search bar component to avoid displaying previous results in case of network issues

Checklist

@pgayvallet
Copy link
Contributor Author

pgayvallet commented Sep 29, 2020

Note: The 'display apps only when the term is empty' logic that is in the searchbar bothers me a little. Ideally, in that case, we would just not be performing a GS search and, instead, retrieving the full app list from core's application.applications$ API. That would avoid unecessary calls to the backend, and avoid having to increase this max result constant to a value that is too high for other providers. Also, the GS API should just not perform any call to the providers when the term is empty.

I didn't do that change in the current PR as I wasn't sure of the future of the 'default state' of the searchbar menu. @ryankeairns is that alright if I open an issue to do this optimization, or are we planning to display other things than just apps when the search term is empty in the near futur?

@myasonik: I think I found a UI bug regarding the searchbar:

  • Open the searchbar by clicking on it
  • Type apm -> only the apm app result is displayed
  • Click on the apm result -> you are redirected to the apm app, and the searchText is cleared
  • click on the searchbar again -> the search term is empty, but the previous results (only apm) are displayed.

I'm guessing this is an unwanted behavior and that we would like to have all results displayed again here?

@pgayvallet pgayvallet added release_note:skip Skip the PR/issue when compiling release notes REASSIGN from Team:Core UI Deprecated label for old Core UI team Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.10.0 labels Sep 29, 2020
@ryankeairns
Copy link
Contributor

Note: The 'display apps only when the term is empty' logic that is in the searchbar bothers me a little. Ideally, in that case, we would just not be performing a GS search and, instead, retrieving the full app list from core's application.applications$ API. That would avoid unecessary calls to the backend, and avoid having to increase this max result constant to a value that is too high for other providers. Also, the GS API should just not perform any call to the providers when the term is empty.

I didn't do that change in the current PR as I wasn't sure of the future of the 'default state' of the searchbar menu. @ryankeairns is that alright if I open an issue to do this optimization, or are we planning to display other things than just apps when the search term is empty in the near future?

@pgayvallet we have this issue to track redesigning the default state. Several ideas have been circulated, none of which individually stood above the rest, so our decision was to release with the app results. From there, we will gather feedback from customers and evaluate whether or not we should move to something else.

The technical implications of the current situation hadn't occurred to me and make a good deal of sense. What I don't have a grasp on is how much of an issue this presents. I would defer to the Platform team on whether or not this should be fixed now versus waiting for another release cycle.

Thanks for bringing this up and explaining it thoroughly.

@pgayvallet
Copy link
Contributor Author

The technical implications of the current situation hadn't occurred to me and make a good deal of sense. What I don't have a grasp on is how much of an issue this presents

The critically is low until we have additional providers. This can definitely wait for the next release cycle.

@ryankeairns
Copy link
Contributor

ryankeairns commented Sep 29, 2020

Ok, understood. I've created a separate issue to track this and linked it to the 'default state redesign' issue. Thanks!

@pgayvallet
Copy link
Contributor Author

@myasonik FYI, created #78786 and #78785

@pgayvallet pgayvallet marked this pull request as ready for review September 29, 2020 17:03
@pgayvallet pgayvallet requested a review from a team as a code owner September 29, 2020 17:03
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core-ui (Team:Core UI)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@pgayvallet pgayvallet requested a review from a team September 29, 2020 17:03
@ryankeairns
Copy link
Contributor

Quick reminder that this one is critical for 7.10. Let me know if I can be of any assistance getting it all cleared. Thanks!

Comment on lines +16 to +18
if (!term) {
return of([]);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick circuit breaker to avoid unnecessary ES calls until we discuss more in details of the expected behavior for empty term searches in #78771

Comment on lines +102 to +106
// cancel pending search if not completed yet
if (searchSubscription.current) {
searchSubscription.current.unsubscribe();
searchSubscription.current = null;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other changes in the file are just cleanup. I just added previous search unsubscription to avoid previous results to be displayed in case of network issue (previous call finishing after next call)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a test for this to avoid breaking in the future?

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If practical, I think a test on the search bar behavior would be good, but otherwise the changes LGTM

Comment on lines +102 to +106
// cancel pending search if not completed yet
if (searchSubscription.current) {
searchSubscription.current.unsubscribe();
searchSubscription.current = null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a test for this to avoid breaking in the future?

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/optimizer bundle module count

id before after diff
globalSearch 22 23 +1

distributable file count

id before after diff
default 47084 47085 +1

page load bundle size

id before after diff
globalSearchBar 28.7KB 29.0KB +321.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pgayvallet pgayvallet merged commit 1e9135c into elastic:master Oct 5, 2020
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Oct 5, 2020
* increase default number of results to show all apps

* fix circuit breaker

* fix ut

* add unit test
pgayvallet added a commit that referenced this pull request Oct 5, 2020
* increase default number of results to show all apps

* fix circuit breaker

* fix ut

* add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REASSIGN from Team:Core UI Deprecated label for old Core UI team release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GS] Observability apps do not appear in initial result set for nav search
6 participants